package com.common.baseException;

import com.common.constant.BaseConst;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @ClassName CustomizeException
 * @Description 自定义异常
 * @Author 吃麻椒的花酱
 * @Date 2022/2/9 21:03
 * @Version 1.0
 */

@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
public class CustomizeException extends RuntimeException{
    private Integer code;
    private String msg;
    public CustomizeException(ExceptionEnum exceptionEnum){
        this.code= exceptionEnum.getCode();
        this.msg = exceptionEnum.getMsg();
    }

    public CustomizeException(String msg){
        this.code= BaseConst.ResCode.ERROR;
        this.msg = msg;
    }
}
